<?php
$this->headLink(array('href' => '/cms/styles/style.css', 'rel' => "stylesheet", 'type' => "text/css"));
$this->headLink(array('href' => '/cms/styles/data-table.css', 'rel' => "stylesheet", 'type' => "text/css"));

$this->headScript()
	->appendFile('/cms/scripts/dojo/dojo.js','',array('djConfig'=> 'parseOnLoad:true, isDebug:false'))
	->setAllowArbitraryAttributes(true);

$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/shadowbox/build/adapter/shadowbox-base.js');
$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/shadowbox/build/shadowbox.js');

$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/TableData.js');
$this->headScript(Zend_View_Helper_HeadScript::SCRIPT,<<<EOD

dojo.require("dijit.form.DateTextBox");
dojo.require("dojo.parser"); 
  
djConfig="parseOnLoad: true";

window.onload = function(){
        Shadowbox.init({
        skipSetup: true // skip the automatic setup
    });

    // set up all anchor elements with a 'photos_add' class to work with Shadowbox
}; 
EOD
);
?>

<style type="text/css">
.headerInput {
	width:364px;
	margin-bottom: 5px;
}
</style>


</head>

<body class="modal">
<form id="form1" name="form1" method="post" action="">
  <h1>Редактирование голосования</h1>
  <table border="0" cellpadding="0" cellspacing="0" class="form">
    <tr>
      <td colspan="2"><div class="stnd_font">Вопрос:</div>
        <input name="question" type="text" class="modalInput headerInput" id="question" value="<?=$this->vote_data['question']?>"/>
        <div class="stnd_font">Статус:</div>
        <select name="status" class="modalInput headerInput" id="status">
          <option value="1" <?=($this->vote_data['status'])? "selected": ""?>>Работает</option>
          <option value="0" <?=($this->vote_data['status'])? "": "selected"?>>Приостановлено</option>
        </select>
        <div class="stnd_font">Окончание голосования:</div>
      <input name="expire_date" type="text" class="modalInput headerInput" id="expire_date" value="<?=$this->vote_data['work_until']?>"/></td>
      <td valign="bottom"><div style="margin-bottom:10px"><a href="#"><img src="/cms/images/calendar_day.png" alt="" width="16" height="16" /></a></div></td>
    </tr>
    <?php 
    //выводим варианты ответов
    $arr = $this->vote_data['answers'];
    $c = count($arr);
    foreach($arr as $a){
    ?>
    <tr>
      <td><input name="answer[<?=$a['id']?>]" type="text" class="modalInput" id="answer1" value="<?=$a['answer']?>" style="width:300px" /></td>
      <td><input name="amount[<?=$a['id']?>]" type="text" class="modalInput" id="amount1" value="<?=$a['votes']?>" style="width:50px" /></td>
      <td><a href="/cms/votes/delanswer/id/<?=$a['id']?>"><img src="/cms/images/cross.png" width="16" height="16" /></a></td>
    </tr>
    <?php } //закончился цикл с вариантами ответов
    ?>
    <tr>
      <td colspan="2" align="right" class="stnd_font">
        <a href="#"><img src="/cms/images/plus.png" width="16" height="16" align="absmiddle" /></a> 
        <a href="/cms/votes/addanswer/id/<?=$this->vote_data['vote_id']?>">Добавить вариант ответа</a></td>
      <td><a href="#"></a></td>
    </tr>
    <tr>
      <td colspan="2" align="right"><input type="submit" class="okButton" id="okButton" name="okButton" value="Сохранить" />
      <input type="button" class="okButton" value="Отмена" onclick="window.parent.setTimeout('Shadowbox.close()',10)" /></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
